#!/bin/bash

src_dir=$1
dst_dir=$2

echo source dir $src_dir
echo destination dir $src_dir

rm -rf $dst_dir

for name in dev test train; do
    {
        for wav in `ls ${src_dir}/${name}/*.wav`; do
            {
                dir_name=`dirname $wav`
                wav=`basename $wav`
                spk=${wav%_*}
                if [ ! -d $spk ]; then
                    mkdir -p $dst_dir/$name/$spk
                fi
                ln -s ${dir_name}/$wav $dst_dir/$name/$spk/$wav
            }
		done
	}&
done
wait
